<HTML> 
<HEAD> 
	<TITLE>3rd Party ROBOTC Drivers</TITLE> 
<link href="tabs.css" rel="stylesheet" type="text/css"/> 
<link href="doxygen.css" rel="stylesheet" type="text/css"/> 
</HEAD> 
 
<BODY bgcolor="#ffffff" link="#000000" vlink="#000000"> 
<table width="100%" bgcolor="navy" cellspacing=0 cellpadding=1 border=0> 
<tr><td><table width="100%" bgcolor="#EEEEDD" cellspacing=0 cellpadding=3 border=0> 
<tr> 
    <td width="33%" align="left"> <img src="images/LOGO_NXT.gif" width=266 height=44 border="0" alt="Mindstorms"></td> 
    <td><b><font size="+3" color="navy">3rd Party ROBOTC Drivers</font></b></td> 
    <td align="right"> <img src="images/logo.png" width=44 height=44 border="0" alt="RobotC"></td>     
</tr> 
  <tr bgcolor="#cccc99" align="right"> 
          <td colspan=3> <font face="arial" size="-1"> [<a href=main.html>Home</a>] [<a target=_top href="https://sourceforge.net/projects/rdpartyrobotcdr/">Download</a>] [<a target=_top href="http://apps.sourceforge.net/mantisbt/rdpartyrobotcdr/my_view_page.php">Submit a bug/suggestion</a>]  [<a target=_top href="http://www.robotc.net/forums/">ROBOTC Forums</a>] [<a target=_top href="http://botbench.com">Blog</a>] [<a target=_top href="http://sourceforge.net/donate/index.php?group_id=257238">Support this project</a>]</font> </td> 
</tr> 
</table></td></tr> 
</table> 
<!-- Generated by Doxygen 1.7.2 -->
<div class="header">
  <div class="headertitle">
<h1>mindsensors-pressure-test1.c</h1>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><span class="preprocessor">#pragma config(Sensor, S1,     MSPPS,                sensorI2CCustom)</span>
<span class="preprocessor"></span><span class="comment">//*!!Code automatically generated by &#39;ROBOTC&#39; configuration wizard               !!*//</span>


<span class="preprocessor">#include &quot;<a class="code" href="mindsensors-pressure_8h.html" title="Mindsensors PPS-v3 driver.">drivers/mindsensors-pressure.h</a>&quot;</span>

task main () {
  <span class="keywordtype">long</span> abspressure;
  <span class="keywordtype">long</span> gaugepressure;

  <span class="comment">// set the sensor to kilo Pascals</span>
  <a name="a0"></a><a class="code" href="group__ppsv3.html#gab82830d179cb0c74c26631b779fe460a">MSPPSsetUnit</a>(MSPPS, <a name="a1"></a><a class="code" href="group__ppsv3.html#gafe54b1797e44f95ba025f63f4a1de2f0">MSPPS_UNIT_PSI</a>);

  wait1Msec(100);
  <a name="a2"></a><a class="code" href="group__ppsv3.html#ga0ccec921593e074a09f47b7ab3c4e48c">MSPPSsetRefPressure</a>(MSPPS);
  wait1Msec(100);

  nxtDisplayCenteredTextLine(0, <span class="stringliteral">&quot;Mindsensors&quot;</span>);
  nxtDisplayCenteredBigTextLine(1, <span class="stringliteral">&quot;PPS-v3&quot;</span>);
  nxtDisplayCenteredTextLine(3, <span class="stringliteral">&quot;Test 1&quot;</span>);
  wait1Msec(2000);

  <span class="comment">// Read the current pressure and feed that to the ref pressure</span>
  <span class="comment">// abspressure = MSPPSreadAbsPressure(MSPPS);</span>
  <span class="comment">// MSPPSsetRefPressure(MSPPS, abspressure);</span>

  <span class="comment">// you can also do this</span>
  <a class="code" href="group__ppsv3.html#ga0ccec921593e074a09f47b7ab3c4e48c">MSPPSsetRefPressure</a>(MSPPS);

  <span class="keywordflow">while</span> (<span class="keyword">true</span>) {
    eraseDisplay();

    abspressure = <a name="a3"></a><a class="code" href="group__ppsv3.html#ga5319bd1e6112483a907d805ee48e722e">MSPPSreadAbsPressure</a>(MSPPS);
    gaugepressure = <a name="a4"></a><a class="code" href="group__ppsv3.html#ga35f687044e31a361a1a2a5addc62888d">MSPPSreadGaugePressure</a>(MSPPS);

    nxtDisplayTextLine(0,<span class="stringliteral">&quot;MSPPS Test 1&quot;</span>);

    nxtDisplayTextLine(2, <span class="stringliteral">&quot;Pressure (KPA):&quot;</span>);
    nxtDisplayTextLine(3, <span class="stringliteral">&quot;Abs: %d&quot;</span>, abspressure);
    nxtDisplayTextLine(4, <span class="stringliteral">&quot;Gauge: %d&quot;</span>, gaugepressure);
    wait1Msec(100);
  }
}

<span class="comment">/*</span>
<span class="comment"> * $Id: mindsensors-pressure-test1.c 108 2012-09-16 09:06:13Z xander $</span>
<span class="comment"> */</span>
</pre></div> </div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Mar 13 2013 19:56:42 for ROBOTC Drivers by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
